<template>
  <div class="row-card video" @click="goArticle">
    <div class="container-left">
      <div class="title">{{ tabData.title }}</div>
      <div class="lable">
        <span class="time">{{ formatTime(tabData.start_time) }}</span>
      </div>
    </div>
    <div class="container-right" v-if="tabData.cover">
      <div class="cover">
        <img :src="tabData.cover" alt="" />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ArticleRow',
  props: {
    tabData: {
      type: Object,
      default: () => ({}),
    },
    type: {
      type: Number,
      default: () => 1,
    },
  },
  data() {
    return {};
  },
  methods: {
    // 时间格式 str 2022-09-09 17:19:15
    formatTime(str) {
      if (!str) {
        return '';
      } else {
        return _t.dealDate(str);
      }
    },
    goArticle() {
      const param = {
        url: this.tabData.link,
        title: this.tabData.title,
      };
      _t.openPdf(param);
    },
  },
};
</script>
<style lang="less" scoped>
.row-card {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(230, 230, 230, 0.4);
}
.container-left {
  display: flex;
  flex-direction: column;
  text-align: left;
  word-break: break-all;
  .title {
    font-size: 0.32rem;
    line-height: 0.48rem;
    padding-top: 0.24rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .lable {
    padding-bottom: 0.24rem;
    margin-top: 0.08rem;
    line-height: 0.32rem;
    font-size: 0.24rem;
    color: rgba(0, 0, 0, 0.4);
  }
}
.container-right {
  .cover {
    margin-top: 0.24rem;
    margin-bottom: 0.24rem;
    width: 1.7rem;
    height: 1.28rem;
    border-radius: 0.08rem;
    overflow: hidden;
    position: relative;
    img {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
